Page({
  data: {
    newsDetail: {}
  },

  onLoad(options) {
    if (options.id) {
      this.loadData(options.id)
    }
  },

  loadData(id) {
    // 替换为实际API调用
    const mockData = {
      title: '新闻标题示例',
      pubTime: new Date().toISOString(),
      author: '系统管理员',
      content: '<p>这里是新闻内容示例...</p>'
    }
    this.setData({newsDetail: mockData})
  },

  formatTime(dateString) {
    if (!dateString) return ''
    const date = new Date(dateString)
    return date.toLocaleString('zh-CN', {
      year: 'numeric',
      month: 'long',
      day: 'numeric',
      hour: '2-digit',
      minute: '2-digit'
    })
  },

  goBack() {
    wx.navigateBack()
  }
})
